import { post } from '@/utils/http'

// API 常量
export const Api = {
  DonatePage: '/donate/page',
  DonateVip: '/donate/sendVip',
  DonateGoodPage: '/donate/goodPage',
  DonateGood: '/donate/sendGood'
} as const

// 请求参数类型
export interface DonateSearchVipReq {
  userNo?: string;
  operator?: string;
  vipLevel?: number;
  pageIndex: number;
  pageSize: number;
}

// 物品赠送查询请求参数类型
export interface DonateSearchGoodReq {
  userNo?: string;
  category?: string;
  operator?: string;
  day?: number;
  pageIndex: number;
  pageSize: number;
}

// 返回数据类型
export interface SendVipLogDto {
  id: string;
  createUser: string | null;
  createTime: string;
  modifyUser: string | null;
  modifyTime: string;
  userNo: string;
  vipLevel: number;
  day: number;
  packageId: string;
  goodList: string;
  reason: string;
  ext: string;
  operator: string;
}

// 物品赠送记录数据类型
export interface SendGoodLogDto {
  id: string;
  createUser: string | null;
  createTime: string;
  modifyUser: string | null;
  modifyTime: string;
  userNo: string;
  goodId: string;
  goodName: string;
  category: string;
  subCategory: string;
  day: number;
  reason: string;
  ext: string;
  operator: string;
}

// 分页返回类型
export interface DonatePageRes {
  hasNextPage: boolean;
  list: SendVipLogDto[] | SendGoodLogDto[];
  nextPage: number;
  count: number;
  total: number;
  size: number;
}

// 赠送VIP请求参数类型
export interface DonateVipReq {
  userNo: string;
  vipLevel: number;
  day: number;
  reason: string;
}

// 赠送物品请求参数类型
export interface DonateGoodReq {
  userNo: string;
  goodId: string;
  day: number;
  reason: string;
}



// 获取VIP赠送记录分页
export function getDonatePageApi(params: DonateSearchVipReq): Promise<{
  code: number;
  data: DonatePageRes;
  message?: string;
}> {
  return post(Api.DonatePage, params)
}

// 获取物品赠送记录分页
export function getDonateGoodPageApi(params: DonateSearchGoodReq): Promise<{
  code: number;
  data: DonatePageRes;
  message?: string;
}> {
  return post(Api.DonateGoodPage, params)
}

// 赠送VIP
export function donateVipApi(params: DonateVipReq): Promise<{
  code: number;
  data: any;
  message?: string;
}> {
  return post(Api.DonateVip, params)
}

// 赠送物品
export function donateGoodApi(params: DonateGoodReq): Promise<{
  code: number;
  data: any;
  message?: string;
}> {
  return post(Api.DonateGood, params)
}

 